package com.lxh.cptp.handler;

import me.chanjar.weixin.cp.bean.WxCpTpXmlPackage;
import me.chanjar.weixin.cp.bean.WxCpXmlOutMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * created by lanxinghua@2dfire.com on 2020/2/23
 */
public abstract class AbstractHandler{
    protected Logger logger = LoggerFactory.getLogger(getClass());

    public abstract WxCpXmlOutMessage handle(WxCpTpXmlPackage wxMessage, Map<String, Object> context);

    protected String getMsgType(WxCpTpXmlPackage wxMessage){
        Map<String, Object> allFieldsMap = wxMessage.getAllFieldsMap();
        return allFieldsMap.get("MsgType").toString();
    }


    protected String getContent(WxCpTpXmlPackage wxMessage){
        Map<String, Object> allFieldsMap = wxMessage.getAllFieldsMap();
        return allFieldsMap.get("Content").toString();
    }


}
